/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/
package com.nurdrobotics;

import edu.wpi.first.wpilibj.Joystick;

/**
 * 
 */
public class ShooterStick {
    // The following variables gives a name to the port that is connected
    // to the shooter joystick.
    // This way, it's easy to look at this section of code to make sure that
    // the shooter joystick is configured correctly in the DriverStation

    private static final int PORT_SHOOTER = 2;
    private static final int RESET_COUNTER = 6;
    // The following variables define names for the axes on the shooter
    // joystick
    // The follwoing variables define names for all the buttons on the
    // shooter joystick
    // declare an variable for holding the joystick
    private static Joystick m_joystick = null;

    static {
        // initialize the joystick
        try {
            m_joystick = new Joystick(PORT_SHOOTER);
        } catch (NoClassDefFoundError e) {
            e.printStackTrace();
        }
    }

    public static boolean ResetCounterPressed() {
        if (m_joystick != null && m_mockPressed == null) {
            return m_joystick.getRawButton(ShooterStick.RESET_COUNTER);
        } else {
            return m_mockPressed.booleanValue();
        }
    }
    /* used by test cases to set mock pressed state
     * if null, the real button state is returned by ResetCounterPressed
     * if true or false, the mock state is returned
     */
    private static Boolean m_mockPressed;

    public static void SetCounterPressed(boolean pressed) {
        m_mockPressed = pressed;
    }
}
